<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
	pageEncoding="ISO-8859-1"%>

<%@ page
	import="java.io.InputStreamReader,java.io.IOException,java.io.PrintWriter,java.sql.ResultSet,
java.util.ArrayList,javax.servlet.ServletException,javax.servlet.annotation.WebServlet,javax.servlet.http.HttpServlet,

javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse,org.apache.log4j.Logger,com.grantha.util.DB,com.mysql.jdbc.Connection
,com.mysql.jdbc.PreparedStatement"%>

<!DOCTYPE html >
<html>
<head>
<jsp:include page="/jsp/header.jsp" />
<title>View Patron</title>
</head>
<body>
	<div class="page2" style="width: 680px;">
		<form id="ViewPatronForm" action="" novalidate="novalidate">


			<div id="vwcontainer">

				<table>
					<%
						String patno = "", name = "", sex = "", address = "", phone = "", designation = "", moreinfo = "", gname = "", gphone = "", gaddress = "";
						boolean isMale = true;
						try {
							patno = request.getParameter("patNo");

							ResultSet rs = DB.search(
									"select * from patronregister where patno = ?", patno);
							if (rs.next()) {
								patno = rs.getString("patno");
								name = rs.getString("name");
								sex = rs.getString("sex");
								address = rs.getString("address");
								phone = rs.getString("phone");
								designation = rs.getString("designation");
								moreinfo = rs.getString("moreinfo");
								gname = rs.getString("gurantername");
								gphone = rs.getString("guranterphone");
								gaddress = rs.getString("guranteraddress");

								if (sex.equals("Mrs."))
									isMale = false;

							}

							rs.close();

						}

						catch (Exception e) {
							System.err.print("Sorry");
						}
					%>


					<tr>
						<td>Member ID:</td>
						<td><input type="text" name="Serial" value="<%=patno%>"
							style="width: 250px" /></td>
					</tr>
					<tr>
						<td>Borrower's Name:</td>
						<td><input type="text" name="name" value="<%=name%>"
							style="width: 250px" /></td>
					</tr>
					<tr>
						<td>Sex:</td>
						<td><input type="radio" name="gender" value="Mr."
							<%if (isMale)
				out.write("checked=\"checked\"");%> />Male<br />
							<input type="radio" name="gender" value="Mrs."
							<%if (!isMale)
				out.write("checked=\"checked\"");%> />Female</td>
					</tr>
					<tr>
						<td>Address:</td>
						<td><input type="text" name="address" value="<%=address%>"
							style="height: 60px; width: 250px" /></td>
					</tr>
					<tr>
						<td>Phone Number:</td>
						<td><input type="text" name="phone" value="<%=phone%>"
							style="width: 250px" /></td>
					</tr>
					<tr>
						<td>Designation:</td>
						<td><input type="text" name="designation"
							value="<%=designation%>" style="width: 250px" /></td>
					</tr>
					<tr>
						<td>Additional Info:</td>
						<td><input type="text" name="addi" value="<%=moreinfo%>"
							style="height: 60px; width: 250px" /></td>
					</tr>
					<tr>
						<td>Guranter Name:</td>
						<td><input type="text" name="gname" value="<%=gname%>"
							style="width: 250px" /></td>
					</tr>
					<tr>
						<td>Guranter Phone:</td>
						<td><input type="text" name="gphone" value="<%=gphone%>"
							style="width: 250px" /></td>
					</tr>
					<tr>
						<td>Guranter Address:</td>
						<td><input type="text" name="gaddress" value="<%=gaddress%>"
							style="height: 60px; width: 250px" /></td>
					</tr>
				</table>
			</div>
			<div id="vwevents" style="margin-left: 380px;">
				<img id="photo" src="${WEB_BASE}images/noimage.jpg" alt="your image" />
				<table>
					<tr>
						<td><input type="file" onchange="readURL(this);" class="vw" /></td>
						<td></td>
						<td></td>
					</tr>
					
					<tr>
						<td><input type="submit" name="jButton4" value="Edit"
							class="vw" /></td>
						<td><input type="submit" name="jButton4" value="Save"
							class="vw" /></td>
						<td><input type="submit" name="jButton4" value="Remove Pic"
							class="vw" /></td>
					</tr>
					<tr>
						<td><input type="submit" name="jButton4" value="Delete"
							class="vw" /></td>
						<td></td>
						<td><input type="submit" name="jButton4" value="Add New"
							class="vw" /></td>
					</tr>
				</table>
			</div>
		</form>
	</div>
	<jsp:include page="/jsp/footer.jsp" />
</body>
</html>